// src/router.js
import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../components/Login.vue'
import Register from '../components/Register.vue'
import CreatePost from '../components/CreatePost.vue'
import PostList from '../components/PostList.vue'
import PostDetail from '../components/PostDetail.vue'
import UserProfile from '../components/UserProfile.vue'

Vue.use(VueRouter)

const routes = [
  { path: '/', component: PostList },
  { path: '/login', component: Login },
  { path: '/register', component: Register },
  { path: '/create', component: CreatePost },
  { path: '/post/:id', component: PostDetail, name: 'PostDetail' },
  { path: '/profile', component: UserProfile, name: 'UserProfile' }
]

const router = new VueRouter({
  mode: 'history',
  routes
})

export default router